package com.cyj.service.impl;

import com.cyj.dao.AnimeEnshrineDao;
import com.cyj.entity.AnimeEnshrine;
import com.cyj.service.AnimeEnshrineService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AnimeEnshrineServiceImpl implements AnimeEnshrineService {
    @Autowired
    private AnimeEnshrineDao animeEnshrineDao;

    @Override
    public AnimeEnshrine selectAnimeEnshrine(Map map) {
        return animeEnshrineDao.selectAnimeEnshrine(map);
    }

    @Override
    public PageInfo<AnimeEnshrine> selectAnimeEnshrineList(Map map, int pn, int pageSize) {
        PageHelper.startPage(pn,pageSize);

        List<AnimeEnshrine> list = animeEnshrineDao.selectAnimeEnshrineList(map);

        PageInfo<AnimeEnshrine> pageInfo = new PageInfo<AnimeEnshrine>(list,5);
        return pageInfo;
    }

    @Override
    public Integer addAnimeEnshrine(AnimeEnshrine animeEnshrine) {
        return animeEnshrineDao.addAnimeEnshrine(animeEnshrine);
    }

    @Override
    public Integer updateAnimeEnshrine(AnimeEnshrine animeEnshrine) {
        return animeEnshrineDao.updateAnimeEnshrine(animeEnshrine);
    }

    @Override
    public Integer deleteAnimeEnshrine(Integer enshrineId) {
        return animeEnshrineDao.deleteAnimeEnshrine(enshrineId);
    }
}
